package com.bristua.barcode.customer.biz;

import com.bristua.barcode.common.util.MD5Util;
import com.bristua.barcode.customer.dao.TCustomerAccountMapper;
import com.bristua.barcode.customer.model.TCustomerAccount;
import com.bristua.barcode.customer.model.condition.TCustomerAccountExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Administrator on 2019/8/26.
 */
@Service
@Transactional
public class SetCustomerRateBiz {


    @Resource
    private TCustomerAccountMapper tCustomerAccountMapper;


    public void setCustomerRate(String rate,String customerId){
        TCustomerAccountExample tCustomerAccountExample = new TCustomerAccountExample();
        tCustomerAccountExample.createCriteria().andCustomerIdEqualTo(customerId);
        List<TCustomerAccount> tCustomerAccounts = tCustomerAccountMapper.selectByExample(tCustomerAccountExample);
        if(tCustomerAccounts!=null && tCustomerAccounts.size()>0){
            TCustomerAccount tCustomerAccount = tCustomerAccounts.get(0);
            TCustomerAccount updateCustomerAccount = new TCustomerAccount();
            updateCustomerAccount.setCustomerAccountId(tCustomerAccount.getCustomerAccountId());
            updateCustomerAccount.setAccountRate(rate);
        }
    }
}
